<template>
	<view>
		<view class="u-flex u-font-18 u-flex-center u-p-t-80">
			ASMR | 登录
		</view>
		<view class="u-flex  u-flex-center u-p-l-40 u-p-r-40 u-flex-column u-m-t-60">
			<view class=" u-m-t-40">
				<u--input placeholder="手机号" border="surround" v-model="value" @change="change"></u--input>
			</view> 
			<view class=" u-m-t-40">
				<u--input placeholder="新密码" border="surround" v-model="value" @change="change"></u--input>
			</view>
			<view class=" u-m-t-40">
				<u-input placeholder="短信验证码">
					<template slot="suffix">
						<u-code ref="uCode" @change="codeChange" seconds="20" changeText="X秒重新获取哈哈哈"></u-code>
						<u-button class="u-reset-button" @tap="getCode" :text="tips" type="success" size="mini"></u-button>
					</template>
				</u-input> 
			</view> 
		</view> 
		<view class=" u-m-t-50 u-wdd-90 u-he-90 u-font-15 u-lihe-90 b-r-10 u-m-auto text-center"
			style="background-color: #ff3b2b;">
			找回密码
		</view>
		

	</view>
</template>

<script>
	export default {
		data() {
			return {
				tips: '',
				value: ''
			}
		},
		methods: {
			codeChange(text) {
				this.tips = text;
			},
			getCode() {
				if (this.$refs.uCode.canGetCode) {
					// 模拟向后端请求验证码
					uni.showLoading({
						title: '正在获取验证码'
					})
					setTimeout(() => {
						uni.hideLoading();
						// 这里此提示会被this.start()方法中的提示覆盖
						uni.$u.toast('验证码已发送');
						// 通知验证码组件内部开始倒计时
						this.$refs.uCode.start();
					}, 2000);
				} else {
					uni.$u.toast('倒计时结束后再发送');
				}
			},
			change(e) {
				console.log('change', e);
			},
			handle(path) {
				uni.$u.route(path)
			}
		}
	}
</script>

<style>
</style>